/**
 * ActiveGossipThread.java
 * ************************** 
 * @date Mar 21, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package gossipServices.gossipThread;

import gossipServices.basic.view.PartialView;

/**
 * Description: 
 * Abstract class that explicitly let the subclass specify the 
 * actions performed by an ActiveThread during the gossip.
 * This class simply wraps the GossipThreadInstructions by
 * translating it to the method: activeThreadInstructions()
 * which must be implement by a subclass.
 *
 */
public abstract class ActiveGossipThread extends GossipThread 
			implements GossipThreadsInstructions, ActiveGossipThreadInterface {

	/**
	 * @param name
	 * @param cycleLengthMsec
	 * @param view
	 * @param gossipProtocol
	 */
	public ActiveGossipThread(String name, long cycleLengthMsec,
			PartialView view) {
		super(name, cycleLengthMsec, view);
		this.gossipProtocol = this; 
	}
	
	public void gossipThreadInstructions() throws InterruptedException{
		activeThreadInstructions();
	}
	
	/**
	 * An ActiveThread has to implement this particular method and
	 * specify in it all required instruction performed by the
	 * active part of the gossip algorithm
	 * @throws InterruptedException
	 */
	abstract public void activeThreadInstructions() throws InterruptedException;
}
